#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <iostream>
#include "common.h"

int main(int argc, char* argv[])
{
    for (int i = 0; i < 10; i++)
    {
        int fd = open("/dev/hello", O_RDWR);

        std::cout<< "fd = " << fd << std::endl;

        sleep(3);

        //方法1
        {
            ioctl(fd, 0xC0506D15);
        }

        //方法2
        {
            //struct AddrInfo addrInfo = {};
            //ioctl(fd, 0xC0506D14, &addrInfo);
            //munmap((void*)addrInfo.virUserAddr, 1<<20);
        }
        
        close(fd);
    }
    return 0;
}

